﻿<UserControl x:Class="VehicleRental.WpfClient.Views.PrivatePlacesView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="300">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVis1" />
    </UserControl.Resources>
    <StackPanel>
        <TabControl Name="tbStores" ItemsSource="{Binding Places}" SelectedIndex="0" DisplayMemberPath="Title" IsSynchronizedWithCurrentItem="True">
            <TabControl.ContentTemplate>
                <DataTemplate>
                    <StackPanel Background="GreenYellow">
                        <StackPanel>
                            <Label Content="Place description: "></Label>
                            <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Padding="5 0 0 0"></TextBlock>
                            <StackPanel Orientation="Horizontal">
                                <Label Content="Place address:"></Label>
                                <TextBlock Text="{Binding Address}" Padding="0 5 0 0"></TextBlock>
                            </StackPanel>
                        </StackPanel>
                        <Grid DataContext="{Binding CurrentVehicle}" VerticalAlignment="Center" Background="LightGreen" >
                            <Grid.RowDefinitions>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                   
                            <Image Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Source="{Binding ImageSource}" Width="200" Height="200"></Image>
                            <Label Grid.Row="1" Grid.Column="0" Content="Manufacturer:" HorizontalAlignment="Right"></Label>
                            <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Manufacturer}"  Padding="0 5 0 0"></TextBlock>
                            <Label Grid.Row="2" Grid.Column="0" Content="Model" HorizontalAlignment="Right"></Label>
                            <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Model}"  Padding="0 5 0 0"></TextBlock>
                            <Label Grid.Row="3" Grid.Column="0" Content="Year of manufacture:" HorizontalAlignment="Right"></Label>
                            <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Year}"  Padding="0 5 0 0"></TextBlock>
                            <Label Grid.Row="4" Grid.Column="0" Content="Vehicle type:" HorizontalAlignment="Right"></Label>
                            <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Type}"  Padding="0 5 0 0"></TextBlock>
                            <Label Grid.Row="5" Grid.Column="0" Content="Price per hour:" HorizontalAlignment="Right"></Label>
                            <TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding PricePerHours}"  Padding="0 5 0 0"></TextBlock>
                            <Label Grid.Row="6" Grid.Column="0" Content="Fee:" HorizontalAlignment="Right"></Label>
                            <TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding Fee}"  Padding="0 5 0 0"></TextBlock>
                            <Label Grid.Row="7" Grid.Column="0" Content="Hours to rent : "></Label>
                            <TextBlock Grid.Row="7" Grid.Column="1" Text="RENTED"  Visibility="{Binding Path=IsRented, Converter={StaticResource BoolToVis1}}"/>
                            <TextBox Grid.Row="7" Grid.Column="1" Text="{Binding RentPeriod}"  Visibility="{Binding Path=IsNotRented, Converter={StaticResource BoolToVis1}}"/>
                            <Button Grid.Row="8" Grid.ColumnSpan="2" Command="{Binding RentCar}" CommandParameter="{Binding}" Content="Rent it!" Visibility="{Binding Path=IsNotRented, Converter={StaticResource BoolToVis1}}"/>
                        </Grid>
                        
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                            <Button Content="Previous vehicle" Command="{Binding PrevVehicle}" Padding="20 10" Margin="20 10"></Button>
                            <Button Content="Next vehicle" Command="{Binding NextVehicle}" Padding="20 10" Margin="20 10"></Button>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </TabControl.ContentTemplate>
        </TabControl>
    </StackPanel>
</UserControl>
